<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="../../include/easyui.jsp" %>
<%@ include file="../../include/pGrid.jsp" %>
<title>用户选择</title>
<script>
	$(function(){
		var dialog =  frameElement.dialog, data = dialog.dialog("get","data") || {singleSelect: false} ;
		var gridParam = {
			singleSelect:  data.singleSelect || false ,
			columns : [[ 
			     { "field" : "account", "width" : 120, "title" : "用户账号" }, 
			     { "field" : "mobile", "width" : 100, "title" : "手机" }, 
			     { "field" : "age", "width" : 80, "title" : "年龄" }, 
			     { "field" : "nickName", "width" : 80, "title" : "姓名" }, 
			     { "field" : "gender", "width" : 80, "title" : "性别" } ,
			     { "field" : "orgId", "width" : 120, "title" : "组织结构" ,formatter:function(value,row,index){
		        	 /*拉去动作列表*/
		        	 $.ajaxSettings.async = false;
		        	 var orgName = "";
		        	 $.getJSON("/console/system/getOrgById", {id: row.orgId} ,function(orgJson){
		        		 orgName = orgJson.orgName || "未知";
		        	 });
		        	 $.ajaxSettings.async = true;
		        	 return orgName ;
		        }}
			]]
		};
		p.dataGrid = $(p.dataGrid).datagrid( $.extend(true, {}, p.dataGridParam,gridParam));

		/*事件响应*/
		$("#toolbar .easyui-linkbutton").on("click", function() {
			var motion_code = $(this).attr("motion_code");p.btnOneClick($(this));
			switch (motion_code) {
				case "05": p.gridQuery(); break;
				default: break;
			}
		});
	});
	
	function choose(){
		var result = { id: '', name: '' };
		var rows = p.dataGrid.datagrid('getSelections'), len = rows.length || 0 ;
		if(len>0){
			var ids = [],names = [];
			$.each(rows,function(index,row){
				ids.push(row.id); names.push(row.nickName);
			});
			result = {
				id: ids.join(","), 
				name: names.join(",")
			}
		}
		return result;
	}
</script>
</head>
<body class="easyui-layout">
	<!-- 但行高度33px，多行时 33乘以行数  -->
	<div data-options="region:'north',split:false,border:false" style="height:33px;">
		<div class="easyui-panel" data-options="fit:true,border:false">
			<!-- 查询条件表单，根据配置进行替换  -->
			<form id="queryForm" >
			 <input type="hidden" name="className" value="${className}" />
			 <div style="margin-top:5px;margin-left:10px;float:left;">
			  	<input class="easyui-textbox" name="nickName" style="width:240px;" data-options="label:'姓名:',required:false" />
				<input type="hidden" name="nickName_searchType" value="like" />
			 </div>
			</form>
		</div>
	</div>  

	<!-- 工具栏按钮 -->
	<div id="toolbar" class="easyui-panel" style="padding:3px;">
      	<a href="#" class="easyui-linkbutton" iconCls="icon-search" motion_code="05" plain="true">查询</a>
	</div>
	
	<!-- 表格 -->
	<div region="center" border="false">
		<table id="dataGrid"></table>
	</div>
</body>
</html>